package cn.tedu.javagame.ball;


public class Board {
    int x,y,width,height;

    public Board(){
        this.x = 200;
        this.y = 400;
        this.width = 100;
        this.height = 20;
    }
    public void move(int x){
        this.x = x;
    }
    public void catchBall(Ball ball){
        if ((ball.x >= this.x )&&(ball.x <= this.x + width) && (ball.y-ball.length<=this.y)&&(ball.y+ball.length >= this.y)){
            if (ball.state == 0){
                ball.state = 2;
            }else if (ball.state == 1){
                ball.state = 3;
            }else if (ball.state == 2){
                ball.state = 0;
            }else if (ball.state == 3){
                ball.state = 1;
            }
        }

    }
}
